package com.wgo.precise.client.ui.view.projecttree;

import static com.wgo.precise.client.ui.controller.PrecisePluginImage.IMG_CREATE_STAKEHOLDER;

import com.wgo.precise.client.ui.controller.RequirementPlugin;
import com.wgo.precise.client.ui.model.StakeholderWrapper;
import com.wgo.precise.client.ui.model.facade.ModelSystem;
import com.wgo.precise.common.VO.Stakeholder;

/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: CreateStakeholderAction.java,v 1.2 2006-01-30 21:52:33 petterei Exp $
 */
public class CreateStakeholderAction extends CreateAction<StakeholderWrapper, ModelSystem<StakeholderWrapper>> {

    public CreateStakeholderAction() {
        super(createText(Stakeholder.class.getSimpleName()), null, IMG_CREATE_STAKEHOLDER.getImageDescriptor());
    }

    /**
     * @see com.wgo.precise.client.ui.view.projecttree.CrudAction#run()
     */
    @Override
    public void run() {
    	ModelSystem<StakeholderWrapper> system = RequirementPlugin.getInstance().getSession().getWrapperFactory().getSystem(StakeholderWrapper.class);
    	setItem(system);
        Stakeholder stakeholder = RequirementPlugin.getInstance().getSession().getDomainSession().createPersistent(Stakeholder.class);
        StakeholderWrapper item = RequirementPlugin.getInstance().getSession().getWrapperFactory().getWrapper(stakeholder);
        item.setParent(system);
        setNewItem(item);
        super.run();
    }

}
